package dates_numbers_currency;

import java.text.*;
import java.util.*;

public class LocaleTest {
	public static void main(String[] args) {
		Calendar c = Calendar.getInstance();	//create a Calendar object
		c.set(2010, 11, 14);	//sets its date
		
		Date d2 = c.getTime();	//converts it to a Date
		
		Locale locIT = new Locale("it", "IT");	//Italy
		Locale locPT = new Locale("pt");		//Portugal
		Locale locBR = new Locale("pt", "BR");	//Brazil
		Locale locIN = new Locale("hi", "IN");	//India
		Locale locJA = new Locale("ja");		//Japan
		Locale locDK = new Locale("da", "DK");			//Denmark
		Locale locUS = Locale.getDefault();
		
		DateFormat dfUS = DateFormat.getDateInstance();
		System.out.println("US " + dfUS.format(d2));
		
		DateFormat dfUSfull = DateFormat.getDateInstance(DateFormat.FULL);
		System.out.println("US full " + dfUSfull.format(d2));
		
		DateFormat dfIT = DateFormat.getDateInstance(DateFormat.FULL, locIT);
		System.out.println("Italy " + dfIT.format(d2));
		
		DateFormat dfPT = DateFormat.getDateInstance(DateFormat.FULL, locPT);
		System.out.println("Portugal " + dfPT.format(d2));
		
		DateFormat dfBR = DateFormat.getDateInstance(DateFormat.FULL, locBR);
		System.out.println("Brazil " + dfBR.format(d2));
		
		DateFormat dfIN = DateFormat.getDateInstance(DateFormat.FULL, locIN);
		System.out.println("India " + dfIN.format(d2));
		
		DateFormat dfJA = DateFormat.getDateInstance(DateFormat.FULL, locJA);
		System.out.println("Japan " + dfJA.format(d2));	
		
		/*
		 * Exam: Locale methods
		 * getDisplayCountry() & getDisplayLanguage()
		 * These methods let you create Strings that represent a given locale's country and language in terms of both the default locale and any other locale.
		 */
		System.out.println("def " + locBR.getDisplayCountry());
		System.out.println("loc " + locBR.getDisplayCountry(locBR));
		System.out.println("lan " + locBR.getDisplayLanguage(locBR));
		
		System.out.println("def " + locDK.getDisplayCountry());
		System.out.println("loc " + locDK.getDisplayCountry(locDK));
		System.out.println("D>I" + locDK.getDisplayCountry(locIT));
	}
}
